package com.yeqifu.bus.controller;

import com.yeqifu.bus.echarts.InportShop;
import com.yeqifu.bus.echarts.SaleShop;
import com.yeqifu.bus.echarts.ShopProvider;
import com.yeqifu.bus.service.IGoodsService;
import com.yeqifu.bus.service.IInportService;
import com.yeqifu.bus.service.ISalesService;
import com.yeqifu.sys.common.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author jsx on 2023/4/12
 **/
@Controller
@RequestMapping("/echarts")
public class EchartsController {

    @Autowired
    private IGoodsService goodsService;
    @Autowired
    private ISalesService salesService;
    @Autowired
    private IInportService inportService;

    //统计供应商的商品最多三个供应商
    @RequestMapping("shop")
    @ResponseBody
    public Result shop(){
        List<ShopProvider> shopProviders = goodsService.selectMaxThreeProvider();
        Result result = new Result();
        result.setData(shopProviders);
        return result;
    }

    @RequestMapping("sale")
    @ResponseBody
    public Result sale(){
        List<SaleShop> saleShops = salesService.selectMaxThreeShop();
        Result result = new Result();
        result.setData(saleShops);
        return result;
    }

    @RequestMapping("inport")
    @ResponseBody
    public Result inport(){
        List<InportShop> inportShops = inportService.selectThreeShop();
        Result result = new Result();
        result.setData(inportShops);
        return result;
    }


}
